class Dog extends Animal{
    public Dog(String name,int age){
        super(name, age);
    }
    @Override  //编译器中方法重写的默认注释
    public void eat() {
        System.out.println(this.name+"在吃狗粮");
    }
    public void run(){
        System.out.println(this.name+"会跑");
    }
}
class Bird extends Animal{
    public Bird(String name, int age) {
        super(name, age);
    }
    public void eat(){
        System.out.println(this.name+"在吃鸟粮");
    }
    public void fly(){
        System.out.println(this.name+"会飞");
    }
}
class Animal{
    public String name;
    public int age;
    public Animal(String name,int age){
        this.name=name;
        this.age=age;
    }
    public void eat(){
        System.out.println(this.name+"在吃饭");
    }
}
public class Test {
    public static void main(String[] args) {
        Animal animal=new Dog("旺财",18);
        Bird bird=(bird)animal;
        bird.fly();
    }
}
